package com.tandashi.springbootstudy01.service.generics;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * Integer 类型的泛型中 添加 String 类型
 */
public class GenericsTest {


    public static void main(String[] args) throws Exception {
        List<Integer> list = new ArrayList<>();
        Method method = list.getClass().getMethod("add", Object.class);
        method.invoke(list,"Java反射机制实现");
        System.out.println(list.get(0));

    }
}
